﻿//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Mapping Application Block
//===============================================================================

using System;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using EntLibContrib.Mapping.Mappers;

namespace EntLibContrib.Mapping.Configuration
{
	/// <summary>
	/// Represents an individual super type element for a <see cref="SuperMapper"/>.
	/// </summary>
	/// <remarks>The name of this element will be the data value from the table.</remarks>
	public class SuperTypeData : NamedConfigurationElement
	{
		#region Constants
		private const string domainObjectSuperTypeNameProperty = "domainObjectSuperTypeName";
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the name of the super type of the domain object.
		/// </summary>
		/// <value>The name of the domain object super type.</value>
		[ConfigurationProperty(domainObjectSuperTypeNameProperty, IsRequired = true)]
		public string DomainObjectSuperTypeName
		{
			get { return (string)base[domainObjectSuperTypeNameProperty]; }
			set { base[domainObjectSuperTypeNameProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initialize a new instance of a <see cref="SuperTypeData"/> class.
		/// </summary>
		public SuperTypeData()
		{ }

		/// <summary>
		/// Intialize a new instance of a <see cref="SuperTypeData"/> class with a name.
		/// </summary>
		/// <param name="name">The data value from the table.</param>
		/// <param name="domainObjectSuperTypeName">Name of the domain object super type.</param>
		public SuperTypeData(string name, string domainObjectSuperTypeName)
			: base(name)
		{
			this.DomainObjectSuperTypeName = domainObjectSuperTypeName;
		}
		#endregion
	}
}
